package com.soft.admin.serviceimpl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.soft.admin.service.IMenuService;
import com.soft.dao.GenericDao;
import com.soft.mapping.Menu;

public class MenuServiceImpl extends GenericDao<Menu> implements IMenuService {

	@SuppressWarnings("unchecked")
	@Override
	public List<Menu> getParentMenuList(Integer parentid) {
		Criteria cr = this.getSession().createCriteria(this.getPojoClass());
		if (parentid != null) {
			cr.add(Restrictions.eq("menu.menuid", parentid));
		} else {
			cr.add(Restrictions.isNull("menu.menuid"));
		}
		cr.add(Restrictions.eq("delflag", (short) 0));
		return cr.list();
	}

}
